<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        ul{
            list-style: none;
        }
        li{
            float: left;
            width: 200px;
            text-align: center
        }
    </style>
    <script>
        function init(){
            window.addEventListener("hashchange",(event)=>{
                let url = location.hash.replace("#","");
                let insertLocation = document.getElementById("insertLocation");
                switch(url){
                    case "emp" :
                        insertLocation.innerHTML = "我是员工";
                        break;
                    case "manager" :
                        insertLocation.innerHTML = "我是管理员";
                        break;
                    default : break;
                }
                console.log(location.hash);
            },false);
        }
        window.addEventListener("load",init,false);
    </script>

</head>
<body>
    <ul>
        <li><a href="#emp">员工</a></li>
        <li><a href="#manager">管理员</a></li>
    </ul>
    <br>
    <hr>
    <section id="insertLocation">

    </section>

</body>
</html>